using Digitalmes.Domain.Entities.Mes.Processes;

namespace Digitalmes.Application.Services;

/// <summary>
/// 工艺路线查询服务。
/// </summary>
public interface IRoutingQueryService : IApplicationService
{
    /// <summary>
    /// 检查工位是否为对应工艺路线的首站。
    /// </summary>
    /// <param name="routingId">工艺路线 Id</param>
    /// <param name="workstationId">工位 Id</param>
    /// <returns></returns>
    Task<bool> IsFirstWorkstationAsync(long routingId, long workstationId);

    /// <summary>
    /// 检查工位是否为对应工艺路线的首站。
    /// </summary>
    /// <param name="productId">产品 Id</param>
    /// <param name="lineId">产线 Id</param>
    /// <param name="workstationId">工位 Id</param>
    /// <returns></returns>
    Task<bool> IsFirstWorkstationAsync(long productId, long lineId, long workstationId);

    /// <summary>
    /// 检查工序是否为对应工艺路线的尾站。
    /// </summary>
    /// <param name="routingId">工艺路线 Id</param>
    /// <param name="operationId">工序 Id</param>
    /// <returns></returns>
    Task<bool> IsFirstOperationAsync(long routingId, long operationId);

    /// <summary>
    /// 检查工序是否为对应工艺路线的尾站。
    /// </summary>
    /// <param name="routingId">工艺路线 Id</param>
    /// <param name="operationId">工序 Id</param>
    /// <returns></returns>
    Task<bool> IsLastOperationAsync(long routingId, long operationId);

    /// <summary>
    /// 获取工艺步骤。
    /// </summary>
    /// <param name="routingId">工艺路线 Id</param>
    /// <param name="operationId">工序 Id</param>
    /// <returns></returns>
    Task<ProcRoutingStep> GetRoutingStepAsync(long routingId, long operationId);

    /// <summary>
    /// 获取工艺步骤。
    /// </summary>
    /// <param name="productId">产品 Id</param>
    /// <param name="lineId">产线 Id</param>
    /// <param name="operationId">工序 Id</param>
    /// <returns></returns>
    Task<ProcRoutingStep?> GetRoutingStepAsync(long productId, long lineId, long operationId);

    /// <summary>
    /// 获取当前工序前最近的关键工艺步骤。
    /// </summary>
    /// <param name="routingId">工艺路线 Id</param>
    /// <param name="operationId">工序 Id</param>
    /// <returns></returns>
    Task<ProcRoutingStep?> GetLastCriticalStepAsync(long routingId, long operationId);
}
